<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Released under the MIT License.
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------

namespace api\wxapp\controller;

use api\wxapp\controller\ApiBaseController;
use api\wxapp\model\Feedback;
use think\Db;
class FeedbackController extends ApiBaseController
{
    public function index()
    {
        $list = Feedback::where('pid',0)->all();
        $this->success('请求成功',$list);
    }
    //
    public function son()
    {
        $params = $this->getParam();
        $this->checkid($params);
        $list = Feedback::where('pid',$params['id'])->all();
        $this->success('请求成功',$list);
    }
    //
    public function add()
    {
        $params = $this->getParam();
        $this->checkuid($params);
        $this->checkcontent($params);
        $this->checkimg($params);
        if(!isset($params['feedback_id'])){
            $this->error('参数缺失!!!!!');
        }
        $params['addtime'] = date('Y-m-d H:i:s');
        $res = db::name('app_feedback_list')->insert($params);
        if($res){
            $this->success('提交成功',true);
        }else{
            $this->error('提交失败',false);
        }
    }
}
